package name.fowler.refactoring.simplestore;

public class CustomerMoviesReport {
	public void report(Customer cust, Formatter fmt) {
		double totalAmount = 0;
		int frequentRenterPoints = 0;
		fmt.header("Rental record for " + cust.getName());
		for (Rental each: cust.getRentals()) {
			double thisAmount = each.bill();
			fmt.println("\t" + each.title() + "\t" + thisAmount);
			totalAmount += thisAmount;
			frequentRenterPoints += each.bonus();
		}
		// Add footer lines
		fmt.println("Amount owed is " + totalAmount);
		fmt.footer(cust.getName() + " has earned " + frequentRenterPoints + " frequent renter points.");
	}
}
